-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Imp upload command #23
Conversation
pacoyang
commented
Dec 6, 2023
- Add support for selecting external EVM account
- Add support for prompting for the project name
- New spinner
if (endpoint === 'wss://poc6.phala.network/ws') { | ||
brickProfileFactoryContractId = '0x4a7861f257568a989a9c24db60981efb745d134a138203a219da051337428b49' | ||
} else if (endpoint === 'wss://poc5.phala.network/ws') { | ||
brickProfileFactoryContractId = '0x489bb4fa807bbe0f877ed46be8646867a8d16ec58add141977c4bd19b0237091' | ||
} else if (endpoint === 'wss://api.phala.network/ws') { | ||
brickProfileFactoryContractId = '0xb59bcc4ea352f3d878874d8f496fb093bdf362fa59d6e577c075f41cd7c84924' | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should using a separate configuration file.
src/lib/PhatBaseCommand.ts
Outdated
async promptEvmAccountId({ | ||
contract, | ||
cert, | ||
}: { | ||
contract: BrickProfileContract, | ||
cert: CertificateData, | ||
}) { | ||
try { | ||
this.action.start('Querying your external accounts') | ||
const { output } = await contract.query.getAllEvmAccounts(cert.address, { | ||
cert, | ||
}) | ||
|
||
} catch (error: any) { | ||
ux.action.stop(chalk.red('Failed to compile.\n')) | ||
return this.error(error) | ||
if (output.isErr) { | ||
throw new Error(output.asErr.toString()) | ||
} | ||
if (output.asOk.isErr) { | ||
throw new Error(output.asOk.asErr.toString()) | ||
} | ||
const accounts = output.asOk.asOk.map((i) => { | ||
const obj = i.toJSON() | ||
return { | ||
id: obj.id, | ||
address: obj.address, | ||
rpcEndpoint: obj.rpc, | ||
} | ||
}) | ||
this.action.stop() | ||
const { account } = await inquirer.prompt({ | ||
name: 'account', | ||
message: 'Please select an external account:', | ||
type: 'list', | ||
choices: accounts.map(account => ({ | ||
name: `${account.address}. ${chalk.dim(account.rpcEndpoint)}`, | ||
value: account.id, | ||
})), | ||
}) | ||
return account | ||
} catch (error) { | ||
this.action.fail('Failed to query your external accounts.') | ||
return this.error(error as Error) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm